<?php
session_start();
	require_once("PHP/db_connect.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet"  href="./css/css.css" type="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script>
<script type="text/javascript" src="./js/jquery.corner.js"></script>
<script type="text/javascript">
	var isLogin = <?php echo array_key_exists("user_id",$_SESSION)?"true":"false"; ?>

	$(document).ready(
		function() {
			$('.box').corner();
			$('.box2').corner();
			$('.box3').corner();
			$('.box4').corner();
	});

	function writeIn(){
		if(!isLogin){
			alert('ログインして下さい');
			return false;
		}
	}
</script>
<title>Insert title here</title>
</head>
<body>
	<div id="container">
		<div id="header" class="box4">
			<div id="logo">
			</div>
			<div id="header_box" >
				<div id="title">
					<img src="./img/logo.png"/>
				</div>
				<div id="search_box">
					<a href="#" id="volunteer">ボランティア</a>｜<a href="#" id="thread">掲示板</a>
					<form method="post" action="./PHP/serch_function/index_search.php?target=volunteer" id="target">
					<input type="text" name="search_word">
					<input type="submit" value="検索する">
					</form>
				</div>
			</div>
		</div>
		<div id="rightnavi" class="box" >

			<form method="post" action="＃" >
			<div align="center">
				<p><a href="#">会員情報表示</a></p>
				<p><a href="#">会員情報変更</a></p>
				<p><a href="#">パスワード変更</a></p>
				<p><a href="#">履歴</a></p>
				<p><a href="#">退会</a></p>
				<p><a href="#">ログアウト</a></p>
				<br />
				</div>
			</form>

		<h3>掲示板</h3>
				<ul class="menu_margin">
	<div id="thread_title_look" >
<?php
	//スレッド項目取得
	$sql = "SELECT t.thread_id,count(thread_name) as thread_count,t.thread_name,max(r.response_date) as response_date,t.thread_id FROM thread AS t LEFT OUTER JOIN response AS r ON t.thread_id = r.thread_id group by t.thread_name order by response_date desc limit 0,5";
	$sth = $db->query($sql);
	if (DB::isError($sth)) {
	  exit($sth->getMessage());
	}

	//スレッド表示
	while ($data = $sth->fetchRow(DB_FETCHMODE_ASSOC)) {

	  echo "<li><a href='./response.php?thread_id=".$data['thread_id']."'>";
	  echo mb_strlen($data['thread_name'])>=9?mb_substr($data['thread_name'],0,9)."...":$data['thread_name'];
	  echo "</a></li>";
	}
?>
				</ul>
				<div id="more"><a href="./thread.php" align="right">もっと見る...</a></div>
	</div>
<div id="main"  class="box3">

</div>




</div>
</body>
</html>
